<template>
  <div id="Vacate_container" style="height: 98%">
    <el-card>
      <div class="searchDiv">
        <div class="searchDivLeft">
          会社名称:
          <el-select v-model="Search.searchbean.groupEnterpriseGuid" placeholder="" class="cpnSelect">
            <el-option v-for="item in options1" :key="item.value" :label="item.label" :value="item.value"> </el-option> </el-select
          >&nbsp; 休暇名称: <el-input v-model="Search.searchbean.lsName" placeholder=""></el-input>&nbsp;
          <el-button type="primary" v-preventReClick icon="el-icon-search" @click="Searchvacate()">検索</el-button>
        </div>
        <div class="searchDivRight">
          <el-button type="primary" v-preventReClick icon="el-icon-plus" @click="dialogFormVisible = true">新規 </el-button>
          <el-button type="warning" v-preventReClick icon="el-icon-edit" @click="Revisemyvacate()">修正</el-button>
          <el-button type="danger" v-preventReClick icon="el-icon-delete" @click="deletemyvacate()">削除</el-button>
          <el-dialog title="新規休暇設定" v-model="dialogFormVisible" @close="resetForm('myvacate')" destroy-on-close>
            <el-scrollbar class="scrollbar">
              <el-form :model="myvacate" :rules="rules" ref="myvacate">
                <el-form-item label="会社名称" prop="groupEnterpriseGuid" :label-width="formLabelWidth">
                  <el-select v-model="myvacate.groupEnterpriseGuid" placeholder=" " class="dialog_detail">
                    <el-option v-for="item in options2" :key="item.value" :label="item.label" :value="item.value"> </el-option>
                  </el-select>
                </el-form-item>
                <el-form-item label="休暇名称" prop="lsName" :label-width="formLabelWidth">
                  <el-input maxlength="100" v-model.trim="myvacate.lsName" autocomplete="off" placeholder=" " class="dialog_detail"> </el-input>
                </el-form-item>
                <el-form-item label="正常出勤か否か" prop="lsFlg" :label-width="formLabelWidth">
                  <el-radio-group v-model="myvacate.lsFlg" class="dialog_detail">
                    <el-radio label="1">はい</el-radio>
                    <el-radio label="0">いいえ</el-radio>
                  </el-radio-group>
                </el-form-item>
                <el-form-item label="最大限休暇日数" prop="lsDayno" :label-width="formLabelWidth">
                  <el-input v-model="myvacate.lsDayno" autocomplete="off" placeholder=" " class="dialog_detail" onkeyup="this.value = this.value.replace(/[^\d.]/g,'');" maxlength="7"></el-input>
                </el-form-item>
                <el-form-item label="毎月休暇時間制限するか否か" prop="lsMonthFlg" :label-width="formLabelWidth">
                  <el-radio-group v-model="myvacate.lsMonthFlg" class="dialog_detail">
                    <el-radio label="1">はい</el-radio>
                    <el-radio label="0">いいえ</el-radio>
                  </el-radio-group>
                </el-form-item>
                <el-form-item label="毎月休暇時間(h)" prop="lsMonthLong" :label-width="formLabelWidth">
                  <el-input v-model="myvacate.lsMonthLong" autocomplete="off" placeholder=" " maxlength="8" class="dialog_detail" onkeyup="this.value = this.value.replace(/[^\d.]/g,'');"></el-input>
                </el-form-item>
                <el-form-item label="毎年休暇時間制限するか否か" prop="lsYearFlg" :label-width="formLabelWidth">
                  <el-radio-group v-model="myvacate.lsYearFlg" class="dialog_detail">
                    <el-radio label="1">はい</el-radio>
                    <el-radio label="0">いいえ</el-radio>
                  </el-radio-group>
                </el-form-item>
                <el-form-item label="毎年休暇時間(h)" prop="lsYearLong" :label-width="formLabelWidth">
                  <el-input v-model="myvacate.lsYearLong" autocomplete="off" placeholder=" " class="dialog_detail" maxlength="8" onkeyup="this.value = this.value.replace(/[^\d.]/g,'');"></el-input>
                </el-form-item>
                <el-form-item label="一日休暇制限するか否か" prop="lsAlldayFlg" :label-width="formLabelWidth">
                  <el-radio-group v-model="myvacate.lsAlldayFlg" class="dialog_detail">
                    <el-radio label="1">はい</el-radio>
                    <el-radio label="0">いいえ</el-radio>
                  </el-radio-group>
                </el-form-item>
                <el-form-item label="貸し越し休暇できるか否か" prop="lsOverdraftFlg" :label-width="formLabelWidth">
                  <el-radio-group v-model="myvacate.lsOverdraftFlg" class="dialog_detail">
                    <el-radio label="1">はい</el-radio>
                    <el-radio label="0">いいえ</el-radio>
                  </el-radio-group>
                </el-form-item>
                <el-form-item label="休暇開始時間" prop="lsBtime" :label-width="formLabelWidth">
                  <el-time-picker v-model="myvacate.lsBtime" value-format="HH:mm:ss" format="HH:mm:ss" placeholder=" "> </el-time-picker>
                </el-form-item>
                <el-form-item label="休暇終了時間	" prop="lsEtime" :label-width="formLabelWidth">
                  <el-time-picker v-model="myvacate.lsEtime" value-format="HH:mm:ss" format="HH:mm:ss" placeholder=" "> </el-time-picker>
                </el-form-item>
                <el-form-item label="毎日最大限休暇時間(h)" prop="lsLong" :label-width="formLabelWidth">
                  <el-input v-model="myvacate.lsLong" autocomplete="off" placeholder=" " maxlength="8" class="dialog_detail" onkeyup="this.value = this.value.replace(/[^\d.]/g,'');"></el-input>
                </el-form-item>
                <el-form-item label="土日を含めるか否か" prop="lsLeaveFlg1" :label-width="formLabelWidth">
                  <el-radio-group v-model="myvacate.lsLeaveFlg1" class="dialog_detail">
                    <el-radio label="1">はい</el-radio>
                    <el-radio label="0">いいえ</el-radio>
                  </el-radio-group>
                </el-form-item>
                <el-form-item label="祝日を含めるか否か" prop="lsLeaveFlg2" :label-width="formLabelWidth">
                  <el-radio-group v-model="myvacate.lsLeaveFlg2" class="dialog_detail">
                    <el-radio label="1">はい</el-radio>
                    <el-radio label="0">いいえ</el-radio>
                  </el-radio-group>
                </el-form-item>
                <el-form-item label="除いた残業設定" prop="lsOvertimeSeting" :label-width="formLabelWidth">
                  <el-select v-model="myvacate.lsOvertimeSeting" class="dialog_detail" @change="clearOvertime('1')">
                    <el-option label="類別を手動選択する" value="0"></el-option>
                    <el-option label="特定類別を除く" value="1"></el-option>
                    <el-option label="優先順位によって除く" value="2"></el-option>
                  </el-select>
                </el-form-item>
                <el-form-item v-if="myvacate.lsOvertimeSeting == '1'" label="除いた残業類別	" prop="lsOvertimeType1" :label-width="formLabelWidth">
                  <el-radio-group v-model="myvacate.lsOvertimeType1" class="dialog_detail">
                    <el-radio label="1">有給休暇</el-radio>
                    <el-radio label="2">福祉休暇</el-radio>
                    <el-radio label="3">去年の残り</el-radio>
                  </el-radio-group>
                </el-form-item>
                <el-form-item v-if="myvacate.lsOvertimeSeting == '2'" label="除いた残業類別1" prop="lsOvertimeType1" :label-width="formLabelWidth">
                  <el-radio-group v-model="myvacate.lsOvertimeType1" class="dialog_detail">
                    <el-radio label="1">有給休暇</el-radio>
                    <el-radio label="2">福祉休暇</el-radio>
                    <el-radio label="3">去年の残り</el-radio>
                  </el-radio-group>
                </el-form-item>
                <el-form-item v-if="myvacate.lsOvertimeSeting == '2'" label="除いた残業類別2" prop="lsOvertimeType2" :label-width="formLabelWidth">
                  <el-radio-group v-model="myvacate.lsOvertimeType2" class="dialog_detail">
                    <el-radio label="1">有給休暇</el-radio>
                    <el-radio label="2">福祉休暇</el-radio>
                    <el-radio label="3">去年の残り</el-radio>
                  </el-radio-group>
                </el-form-item>
                <el-form-item v-if="myvacate.lsOvertimeSeting == '2'" label="除いた残業類別3" prop="lsOvertimeTyp3" :label-width="formLabelWidth">
                  <el-radio-group v-model="myvacate.lsOvertimeType3" class="dialog_detail">
                    <el-radio label="1">有給休暇</el-radio>
                    <el-radio label="2">福祉休暇</el-radio>
                    <el-radio label="3">去年の残り</el-radio>
                  </el-radio-group>
                </el-form-item>
                <el-button type="primary" icon="el-icon-circle-check" v-preventReClick @click="submitmyvacate()" class="save">保存 </el-button>
              </el-form>
            </el-scrollbar>
          </el-dialog>
          <el-dialog title="休暇設定修正" v-model="dialogFormVisible1" >
            <el-scrollbar class="scrollbar">
              <el-form :model="update" :rules="rules" ref="update" @close="resetForm('update')">
                <el-form-item label="会社名称" prop="groupEnterpriseGuid" :label-width="formLabelWidth">
                  <el-select v-model="update.groupEnterpriseGuid" placeholder=" " class="dialog_detail">
                    <el-option v-for="item in options2" :key="item.value" :label="item.label" :value="item.value"> </el-option>
                  </el-select>
                </el-form-item>
                <el-form-item label="休暇名称" prop="lsName" :label-width="formLabelWidth">
                  <el-input maxlength="100" v-model.trim="update.lsName" autocomplete="off" placeholder=" " class="dialog_detail"> </el-input>
                </el-form-item>
                <el-form-item label="正常出勤か否か" prop="lsFlg" :label-width="formLabelWidth">
                  <el-radio-group v-model="update.lsFlg" class="dialog_detail">
                    <el-radio label="1">はい</el-radio>
                    <el-radio label="0">いいえ</el-radio>
                  </el-radio-group>
                </el-form-item>
                <el-form-item label="最大限休暇日数" prop="lsDayno" :label-width="formLabelWidth">
                  <el-input v-model="update.lsDayno" autocomplete="off" placeholder=" " class="dialog_detail" onkeyup="this.value = this.value.replace(/[^\d.]/g,'');" maxlength="7"></el-input>
                </el-form-item>
                <el-form-item label="毎月休暇時間制限するか否か" prop="lsMonthFlg" :label-width="formLabelWidth">
                  <el-radio-group v-model="update.lsMonthFlg" class="dialog_detail">
                    <el-radio label="1">はい</el-radio>
                    <el-radio label="0">いいえ</el-radio>
                  </el-radio-group>
                </el-form-item>
                <el-form-item label="毎月休暇時間(h)" prop="lsMonthLong" :label-width="formLabelWidth">
                  <el-input v-model="update.lsMonthLong" autocomplete="off" placeholder=" " class="dialog_detail" maxlength="8" onkeyup="this.value = this.value.replace(/[^\d.]/g,'');"></el-input>
                </el-form-item>
                <el-form-item label="毎年休暇時間制限するか否か" prop="lsYearFlg" :label-width="formLabelWidth">
                  <el-radio-group v-model="update.lsYearFlg" class="dialog_detail">
                    <el-radio label="1">はい</el-radio>
                    <el-radio label="0">いいえ</el-radio>
                  </el-radio-group>
                </el-form-item>
                <el-form-item label="毎年休暇時間(h)" prop="lsYearLong" :label-width="formLabelWidth">
                  <el-input v-model="update.lsYearLong" autocomplete="off" placeholder=" " maxlength="8" class="dialog_detail" onkeyup="this.value = this.value.replace(/[^\d.]/g,'');"></el-input>
                </el-form-item>
                <el-form-item label="一日休暇制限するか否か" prop="lsAlldayFlg" :label-width="formLabelWidth">
                  <el-radio-group v-model="update.lsAlldayFlg" class="dialog_detail">
                    <el-radio label="1">はい</el-radio>
                    <el-radio label="0">いいえ</el-radio>
                  </el-radio-group>
                </el-form-item>
                <el-form-item label="貸し越し休暇できるか否か" prop="lsOverdraftFlg" :label-width="formLabelWidth">
                  <el-radio-group v-model="update.lsOverdraftFlg" class="dialog_detail">
                    <el-radio label="1">はい</el-radio>
                    <el-radio label="0">いいえ</el-radio>
                  </el-radio-group>
                </el-form-item>
                <el-form-item label="休暇開始時間" prop="lsBtime" :label-width="formLabelWidth">
                  <el-time-picker v-model="update.lsBtime" value-format="HH:mm:ss" format="HH:mm:ss" placeholder=" "> </el-time-picker>
                </el-form-item>
                <el-form-item label="休暇終了時間" prop="lsEtime" :label-width="formLabelWidth">
                  <el-time-picker v-model="update.lsEtime" value-format="HH:mm:ss" format="HH:mm:ss" placeholder=" "> </el-time-picker>
                </el-form-item>
                <el-form-item label="毎日最大限休暇時間(h)" prop="lsLong" :label-width="formLabelWidth">
                  <el-input v-model="update.lsLong" autocomplete="off" maxlength="8" placeholder=" " class="dialog_detail" onkeyup="this.value = this.value.replace(/[^\d.]/g,'');"></el-input>
                </el-form-item>
                <el-form-item label="土日を含めるか否か" prop="lsLeaveFlg1" :label-width="formLabelWidth">
                  <el-radio-group v-model="update.lsLeaveFlg1" class="dialog_detail">
                    <el-radio label="1">はい</el-radio>
                    <el-radio label="0">いいえ</el-radio>
                  </el-radio-group>
                </el-form-item>
                <el-form-item label="祝日を含めるか否か" prop="lsLeaveFlg2" :label-width="formLabelWidth">
                  <el-radio-group v-model="update.lsLeaveFlg2" class="dialog_detail">
                    <el-radio label="1">はい</el-radio>
                    <el-radio label="0">いいえ</el-radio>
                  </el-radio-group>
                </el-form-item>
                <el-form-item label="除いた残業設定" prop="lsOvertimeSeting" :label-width="formLabelWidth">
                  <el-select v-model="update.lsOvertimeSeting" class="dialog_detail" @change="clearOvertime()">
                    <el-option label="類別を手動選択する" value="0"></el-option>
                    <el-option label="特定類別を除く" value="1"></el-option>
                    <el-option label="優先順位によって除く" value="2"></el-option>
                  </el-select>
                </el-form-item>
                <el-form-item v-if="update.lsOvertimeSeting == '1'" label="除いた残業類別" prop="lsOvertimeType1" :label-width="formLabelWidth">
                  <el-radio-group v-model="update.lsOvertimeType1" class="dialog_detail" >
                    <el-radio label="1">有給休暇</el-radio>
                    <el-radio label="2">福祉休暇</el-radio>
                    <el-radio label="3">去年の残り</el-radio>
                  </el-radio-group>
                </el-form-item>
                <el-form-item v-if="update.lsOvertimeSeting == '2'" label="除いた残業類別1" prop="lsOvertimeType1" :label-width="formLabelWidth">
                  <el-radio-group v-model="update.lsOvertimeType1" class="dialog_detail">
                    <el-radio label="1">有給休暇</el-radio>
                    <el-radio label="2">福祉休暇</el-radio>
                    <el-radio label="3">去年の残り</el-radio>
                  </el-radio-group>
                </el-form-item>
                <el-form-item v-if="update.lsOvertimeSeting == '2'" label="除いた残業類別2" prop="lsOvertimeType2" :label-width="formLabelWidth">
                  <el-radio-group v-model="update.lsOvertimeType2" class="dialog_detail">
                    <el-radio label="1">有給休暇</el-radio>
                    <el-radio label="2">福祉休暇</el-radio>
                    <el-radio label="3">去年の残り</el-radio>
                  </el-radio-group>
                </el-form-item>
                <el-form-item v-if="update.lsOvertimeSeting == '2'" label="除いた残業類別3" prop="lsOvertimeTyp3" :label-width="formLabelWidth">
                  <el-radio-group v-model="update.lsOvertimeType3" class="dialog_detail">
                    <el-radio label="1">有給休暇</el-radio>
                    <el-radio label="2">福祉休暇</el-radio>
                    <el-radio label="3">去年の残り</el-radio>
                  </el-radio-group>
                </el-form-item>
                <el-button type="primary" icon="el-icon-circle-check" @click="updatemyvacate()" class="save">保存 </el-button>
              </el-form>
            </el-scrollbar>
          </el-dialog>
        </div>
      </div>
      <el-table :data="Searchlist" border style="width: 100%" :header-cell-style="{ background: '#f2f2f2', color: '#606266' }" @selection-change="handleSelectionChange">
        <el-table-column type="selection" width="55"> </el-table-column>
        <el-table-column prop="lsName" label="休暇名称"> </el-table-column>
        <el-table-column prop="lsFlg" label="正常出勤か否か">
          <template #default="scope">
            <p v-if="scope.row.lsFlg == 1">はい</p>
            <p v-if="scope.row.lsFlg == 0">いいえ</p>
          </template>
        </el-table-column>
        <el-table-column prop="lsDayno" label="最大限休暇日数"> </el-table-column>
        <el-table-column prop="lsMonthFlg" label="毎月休暇時間制限するか否か">
          <template #default="scope">
            <p v-if="scope.row.lsMonthFlg == 1">はい</p>
            <p v-if="scope.row.lsMonthFlg == 0">いいえ</p>
          </template>
        </el-table-column>
        <el-table-column prop="lsMonthLong" label="毎月休暇時間(h)"> </el-table-column>
        <el-table-column prop="lsYearFlg" label="毎年休暇時間制限するか否か">
          <template #default="scope">
            <p v-if="scope.row.lsYearFlg == 1">はい</p>
            <p v-if="scope.row.lsYearFlg == 0">いいえ</p>
          </template>
        </el-table-column>
        <el-table-column prop="lsYearLong" label="毎年休暇時間(h)"> </el-table-column>
        <el-table-column prop="lsAlldayFlg" label="一日休暇制限するか否か">
          <template #default="scope">
            <p v-if="scope.row.lsAlldayFlg == 1">はい</p>
            <p v-if="scope.row.lsAlldayFlg == 0">いいえ</p>
          </template>
        </el-table-column>
        <el-table-column prop="lsOverdraftFlg" label="貸し越し休暇できるか否か">
          <template #default="scope">
            <p v-if="scope.row.lsOverdraftFlg == 1">はい</p>
            <p v-if="scope.row.lsOverdraftFlg == 0">いいえ</p>
          </template>
        </el-table-column>
        <el-table-column prop="lsBtime" label="休暇開始時間"> </el-table-column>
        <el-table-column prop="lsEtime" label="休暇終了時間"> </el-table-column>
      </el-table>
      <div class="divider_pagination">
        <!-- <el-divider></el-divider> -->
        <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="Search.indexPage"
          :page-size="Search.pageSize"
          layout="total, prev, pager, next, jumper"
          :total="total"
        >
        </el-pagination>
      </div>
    </el-card>
  </div>
</template>

<script>
export default {
  data() {
    return {
      Search: {
        searchbean: {
          groupEnterpriseGuid: '',
          lsName: ''
        },
        indexPage: 1,
        pageSize: 8
      },
      Searchlist: [],
      total: 0,
      multipleSelection: [],
      options1: [
        {
          value: '',
          label: '全部'
        }
      ],
      options2: [],
      value1: '',
      dialogFormVisible: false,
      dialogFormVisible1: false,
      // 新增
      myvacate: {
        groupEnterpriseGuid: '',
        lsName: '',
        lsFlg: '1',
        lsDayno: '',
        lsMonthFlg: '1',
        lsMonthLong: '',
        lsYearFlg: '1',
        lsYearLong: '',
        lsAlldayFlg: '1',
        lsOverdraftFlg: '1',
        lsBtime: '',
        lsEtime: '',
        lsLong: '',
        lsLeaveFlg1: '1',
        lsLeaveFlg2: '1',
        lsOvertimeSeting: '0',
        lsOvertimeType1: '',
        lsOvertimeType2: '',
        lsOvertimeType3: ''
      },
      formLabelWidth: '250px',
      innerVisible: false,
      rules: {
        groupEnterpriseGuid: [{ required: true, message: '会社を選択してください', trigger: 'change' }],
        lsName: [{ required: true, message: '休暇名称を入力してください', trigger: 'blur' }],
        lsDayno: [{ required: true, message: '最大限休暇日数を入力してください', trigger: 'blur' }],
        lsMonthLong: [
          { required: true, message: ' 毎月休暇時間を入力してください', trigger: 'blur' },
          { message: '720時間を超えてはいけません', pattern: /^([0-9]|[1-9]\d|[1-6][0-9]\d|7[0-1]\d|720)$/, trigger: 'blur' }
        ],
        lsYearLong: [
          { required: true, message: ' 毎年休暇時間を入力してください', trigger: 'blur' },
          { message: '8624時間を超えてはいけません', pattern: /^([0-9]|[1-9]\d|[1-9][0-9]\d|[1-8][0-5]\d\d|86[0-1]\d|862[0-4])$/, trigger: 'blur' }
        ],
        lsBtime: [{ required: true, message: '休暇開始時間を選択してください', trigger: 'change' }],
        lsEtime: [{ required: true, message: '休暇終了時間を選択してください', trigger: 'change' }],
        lsLong: [
          { required: true, message: '毎天休暇時間を入力してください', trigger: 'blur' },
          { message: '24時間を超えてはいけません', pattern: /^([0-9]|1\d|2[0-4])$/, trigger: 'blur' }
        ]
      },
      // 修改
      update: {
        lsGuid: '',
        groupEnterpriseGuid: '',
        lsName: '',
        lsFlg: '',
        lsDayno: '',
        lsMonthFlg: '',
        lsMonthLong: '',
        lsYearFlg: '',
        lsYearLong: '',
        lsAlldayFlg: '',
        lsOverdraftFlg: '',
        lsBtime: '',
        lsEtime: '',
        lsLong: '',
        lsLeaveFlg1: '',
        lsLeaveFlg2: '',
        lsOvertimeSeting: '',
        lsOvertimeType1: '',
        lsOvertimeType2: '',
        lsOvertimeType3: ''
      },
      // 删除
      delete: {
        lsGuids: []
      }
    }
  },
  created() {
    this.Searchid()
  },
  methods: {
    resetForm(formName) {
      this.$refs[formName].resetFields()
    },
    handleSelectionChange(val) {
      this.multipleSelection = val
      console.log(this.multipleSelection)
    },
    handleSizeChange(newSize) {
      console.log(newSize)
      this.Search.pageSize = newSize
      this.Searchvacate()
    },
    handleCurrentChange(newPage) {
      console.log(newPage)
      this.Search.indexPage = newPage
      this.Searchvacate()
    },
    Searchid() {
      function id(value, label) {
        this.value = value
        this.label = label
      }
      this.axios
        .post('/role/selectAllEnterprise')
        .then((res) => {
          this.Searchvacate()
          console.log(res)
          res.data.data.forEach((item) => {
            this.options1.push(new id(item.groupEnterpriseGuid, item.enterpriseName))
            this.options2.push(new id(item.groupEnterpriseGuid, item.enterpriseName))
          })
          console.log(this.options2)
        })
        .catch((error) => {
          console.log(error)
        })
    },
    // 检索
    Searchvacate() {
      console.log(this.Search)
      this.axios
        .post('/leavesetting/select/list', this.Search)
        .then((res) => {
          this.Searchlist = res.data.data.list
          for (var i = 0; i < res.data.data.list.length; i++) {
            this.Searchlist[i].lsBtime = res.data.data.list[i].lsBtime.substring(11, 19)
            this.Searchlist[i].lsEtime = res.data.data.list[i].lsEtime.substring(11, 19)
          }
          this.total = res.data.data.total
          console.log(this.Searchlist)
        })
        .catch((error) => {
          console.log(error)
        })
    },
    // 新規
    submitmyvacate() {
      this.$refs.myvacate.validate((valid) => {
        console.log(this.myvacate)
        if (valid) {
          console.log(this.myvacate)
          this.axios
            .post('/leavesetting/insert', this.myvacate)
            .then((res) => {
              if (res.data.success !== 1) return this.$message.error(res.data.msg)
              this.$message.success(this.$getMsg('I0001'))
              this.Searchvacate()
              this.dialogFormVisible = false
            })
            .catch((error) => {
              console.log(error)
            })
        }
      })
    },
    // 修正
    Revisemyvacate() {
      if (this.multipleSelection.length !== 1) {
        return this.$message({
          showClose: true,
          message: this.$getMsg('W0001'),
          type: 'warning'
        })
      }
      this.dialogFormVisible1 = true
      this.update.lsGuid = this.multipleSelection[0].lsGuid
      console.log(this.update.lsGuid)
      this.update.groupEnterpriseGuid =this.multipleSelection[0].groupEnterpriseGuid
      this.update.lsName = this.multipleSelection[0].lsName
      this.update.lsFlg = this.multipleSelection[0].lsFlg
      this.update.lsDayno = this.multipleSelection[0].lsDayno
      this.update.lsMonthFlg = this.multipleSelection[0].lsMonthFlg
      this.update.lsMonthLong = this.multipleSelection[0].lsMonthLong
      this.update.lsYearFlg = this.multipleSelection[0].lsYearFlg
      this.update.lsYearLong = this.multipleSelection[0].lsYearLong
      this.update.lsAlldayFlg = this.multipleSelection[0].lsAlldayFlg
      this.update.lsOverdraftFlg = this.multipleSelection[0].lsOverdraftFlg
      this.update.lsBtime = this.multipleSelection[0].lsBtime
      this.update.lsEtime = this.multipleSelection[0].lsEtime
      this.update.lsLong = this.multipleSelection[0].lsLong
      this.update.lsLeaveFlg1 = this.multipleSelection[0].lsLeaveFlg1
      this.update.lsLeaveFlg2 = this.multipleSelection[0].lsLeaveFlg2
      this.update.lsOvertimeSeting = this.multipleSelection[0].lsOvertimeSeting
      this.update.lsOvertimeType1 = this.multipleSelection[0].lsOvertimeType1
      this.update.lsOvertimeType2 = this.multipleSelection[0].lsOvertimeType2
      this.update.lsOvertimeType3 = this.multipleSelection[0].lsOvertimeType3
      console.log(this.update.lsOvertimeType3)
    },
    updatemyvacate() {
      if (this.update.lsOvertimeSeting == '0') {
        this.update.lsOvertimeType1 = ''
        this.update.lsOvertimeType2 = ''
        this.update.lsOvertimeType3 = ''
      }
      if (this.update.lsOvertimeSeting == '1') {
        this.update.lsOvertimeType2 = ''
        this.update.lsOvertimeType3 = ''
      }
      this.$refs.update.validate((valid) => {
        if (valid) {
          this.axios
            .put('/leavesetting/update', this.update)
            .then((res) => {
              console.log(res)
              if (res.data.success === 0) {
                return this.$message.error(res.data.msg)
              }
              this.$message.success(this.$getMsg('I0002'))
              this.Searchvacate()
              this.dialogFormVisible1 = false
            })
            .catch((error) => {
              console.log(error)
            })
        }
      })
    },
    // 削除
    deletemyvacate() {
      this.delete.lsGuids = []
      if (this.multipleSelection.length === 0) {
        return this.$message({
          showClose: true,
          message: this.$getMsg('W0002'),
          type: 'warning'
        })
      }
      console.log(this.multipleSelection)
      this.multipleSelection.forEach((item) => {
        this.delete.lsGuids.push(item.lsGuid)
      })
      console.log(this.delete.lsGuids)
      this.$confirm(this.$getMsg('I0004'), {
        cancelButtonText: 'キャンセル',
        confirmButtonText: '確認',
        type: 'warning'
      }).then(() => {
        this.axios
          .delete('/leavesetting/delete', {
            data: this.delete
          })
          .then(() => {
            this.$message.success(this.$getMsg('I0003'))
            this.Searchvacate()
          })
          .catch((error) => {
            console.log(error)
          })
      },
      (res)=>{
        console.log(res)
      })
    },
    clearOvertime(flg){
      if(flg == '1'){
        if(this.myvacate.lsOvertimeSeting == '0'){
          this.myvacate.lsOvertimeType1 = ''
          this.myvacate.lsOvertimeType2 = ''
          this.myvacate.lsOvertimeType3 = ''
        }
        if(this.myvacate.lsOvertimeSeting == '1'){
          this.myvacate.lsOvertimeType1 = '1'
          this.myvacate.lsOvertimeType2 = ''
          this.myvacate.lsOvertimeType3 = ''
        }
        if(this.myvacate.lsOvertimeSeting == '2'){
          this.myvacate.lsOvertimeType1 = '1'
          this.myvacate.lsOvertimeType2 = '1'
          this.myvacate.lsOvertimeType3 = '1'
        }
      }else{
        if(this.update.lsOvertimeSeting == this.multipleSelection[0].lsOvertimeSeting){
          this.update.lsOvertimeType1 = this.multipleSelection[0].lsOvertimeType1
          this.update.lsOvertimeType2 = this.multipleSelection[0].lsOvertimeType2
          this.update.lsOvertimeType3 = this.multipleSelection[0].lsOvertimeType3
        }else{
          if(this.update.lsOvertimeSeting == '0'){
            this.update.lsOvertimeType1 = ''
            this.update.lsOvertimeType2 = ''
            this.update.lsOvertimeType3 = ''
          }
          if(this.update.lsOvertimeSeting == '1'){
            this.update.lsOvertimeType1 = '1'
            this.update.lsOvertimeType2 = ''
            this.update.lsOvertimeType3 = ''
          }
          if(this.update.lsOvertimeSeting == '2'){
            this.update.lsOvertimeType1 = '1'
            this.update.lsOvertimeType2 = '1'
            this.update.lsOvertimeType3 = '1'
          }
        }
      }
    }
  }
}
</script>

<style scoped>
.el-divider {
  position: absolute;
  bottom: 75px;
  width: 1030px;
}

.el-input {
  width: 140px;
}

:deep(.el-date-editor.el-input, .el-date-editor.el-input__inner) {
  width: 380px !important;
}

.dialog_detail {
  width: 380px;
}

.el-radio.el-radio--medium {
  padding-right: 20px;
}

:deep(.el-form-item__error) {
  width: 100%;
}

.save {
  position: relative;
  left: 310px;
  top: 0px;
}

:deep(.el-input--mini .el-input__icon) {
  line-height: 35px;
}
.el-scrollbar__wrap {
  overflow: hidden;
}
.scrollbar{
  height: 600px;
}
::deep .el-overlay-dialog {
  position: fixed;
  overflow: none !important;
}
:deep(.el-form-item__label) {
  width: 230px !important;
}
</style>
